package com.campus.counseling.service;

import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
import com.campus.counseling.entity.Appointment;

@Service
@RequiredArgsConstructor
public class AppointmentStatusService {
    
    private final AppointmentService appointmentService;
    
    public void confirmAppointment(Long appointmentId) {
        Appointment appointment = appointmentService.getById(appointmentId);
        if (appointment != null && !"CONFIRMED".equals(appointment.getStatus())) {
            appointment.setStatus("CONFIRMED");
            appointmentService.updateById(appointment);
        }
    }
    
    public void cancelAppointment(Long appointmentId, String reason) {
        Appointment appointment = appointmentService.getById(appointmentId);
        if (appointment != null) {
            appointment.setStatus("CANCELLED");
            appointment.setCancelReason(reason);
            appointmentService.updateById(appointment);
        }
    }
} 